package utility;

import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;

/**
 * Classe per la scrittura degli output su file.
 * @author Giovanni Richini
 * @author Michael Maghella
 * @version 1.0
 *
 */
public class WriteFile {
	
	/**
	 * Istanza PrintWriter
	 * @uml.property  name="writer"
	 */
	PrintWriter writer;
	
	/**
	 * Costruttore della classe.
	 * @param nome_circuito
	 */
	public WriteFile(String nome_circuito) {
		try {
			writer = new PrintWriter(nome_circuito, "US-ASCII");
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}
	
	/**
	 * Scrive una stringa nel file di testo
	 * @param input
	 */
	public void writeFile(String input){
		writer.println(input);
	}
	
	/**
	 * Chiusura del file
	 */
	public void closeFile(){
		writer.close();
	}
}
